package main;

import java.io.StreamCorruptedException;

import TransferObjekts.Line;
import TransferObjekts.Word;
import ourfilter.CircularShiftFilter;
import ourfilter.IgnoreWordFilter;
import ourfilter.OurSink;
import ourfilter.SortLinesFilter;
import ourfilter.Source;
import ourfilter.TokenizerFilter;
import pipes.Pipe;

public class PipefFlterRun {

	public static void main(String[] args) throws StreamCorruptedException {
		
		{
			Pipe<Line> p1 = new Pipe<Line>();
			Pipe<Word> p2 = new Pipe<Word>();
			Pipe<Word> p3 = new Pipe<Word>();
			Pipe<Line> p4 = new Pipe<Line>();
			Pipe<Line> p5 = new Pipe<Line>();

			Source src = new Source("aliceInWonderland.txt", p1);

			TokenizerFilter tokenizerFilter = new TokenizerFilter(p1, p2);
			IgnoreWordFilter igf = new IgnoreWordFilter(p2, p3);
			CircularShiftFilter csf = new CircularShiftFilter(p3, p4);
			SortLinesFilter slf = new SortLinesFilter(p4, p5);
			OurSink sink = new OurSink(p5, "out.txt");

			sink.run();
		}
		/*
		{
			Pipe<Line> p1 = new Pipe<Line>();
			Pipe<Word> p2 = new Pipe<Word>();
			Pipe<Word> p3 = new Pipe<Word>();
			Pipe<Line> p4 = new Pipe<Line>();
			Pipe<Line> p5 = new Pipe<Line>();

			Source src = new Source("aliceInWonderland.txt", p1);

			TokenizerFilter tokenizerFilter = new TokenizerFilter(p1, p2);
			IgnoreWordFilter igf = new IgnoreWordFilter(p2, p3);
			CircularShiftFilter csf = new CircularShiftFilter(p3, p4);
			//SortLinesFilter slf = new SortLinesFilter(p4, p5);
			OurSink sink = new OurSink(p4, "out.txt");
			
			src.run();
		}
		*/
	}
}
